﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BarberShop.BLL;
using BarberShop.Data;

using Maticsoft.Common;


public partial class MoviePlayListAdd : BasePage
{
    public int Id
    {
        get
        {
            return string.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : Convert.ToInt32(Request.QueryString["id"]);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetData();
        }
    }

    protected void GetData()
    {
        if (Id != 0)
        {
            var info = MoviePalyListBLL.GetMovePlayListInfo(Id);
            txt_brandName.Text = info.Name;
        }
    }

    protected void btn_add_Click(object sender, EventArgs e)
    {
        if (Id == 0)
        {
            MovePlayListInfo info = new MovePlayListInfo();
            info.Name = txt_brandName.Text.Trim();
            info.Status = 1;
            info.CreateDate = DateTime.Now;
            var r = MoviePalyListBLL.AddMovePlayListInfo(info);
            if (r)
            {
                MsgBox("保存成功！");
            }
            else { MsgBox("保存失败！"); }
        }
        else
        {
            MovePlayListInfo info = MoviePalyListBLL.GetMovePlayListInfo(Id);
            info.Name = txt_brandName.Text.Trim();
            var r = MoviePalyListBLL.UpdateMovePlayListInfo(info);
            if (r)
            {
                MsgBox("修改成功！");
            }
            else { MsgBox("修改失败！"); }
        }
    }


}